﻿<%@ Page Title="Categories" EnableEventValidation="false" Language="C#" MasterPageFile="~/Site.Master"
    AutoEventWireup="true" CodeBehind="Categories.aspx.cs" Inherits="TicketingSystemAsp.Categories" %>

<%--<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>--%>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ListView ID="CategoriesListView" runat="server" DataKeyNames="CategoryID" ItemPlaceholderID="ItemPlaceHolder"
        OnItemEditing="CategoryEdit" OnItemUpdating="UpdateCategory" OnItemDeleting="DeleteCategory" OnItemInserting="AddCategory"
        InsertItemPosition="LastItem">
        <LayoutTemplate>
            <table>
                <tr>
                    <th>
                        Category Name
                    </th>
                </tr>
                <asp:PlaceHolder ID="ItemPlaceHolder" runat="server" />
            </table>
        </LayoutTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <asp:Literal Text='<%# Eval("CategoryName") %>' runat=server Mode="Encode"></asp:Literal>
                    <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("CategoryID") %>' Visible="false"/>
                </td>
                <td><asp:LinkButton ID="EditButton" Text="Edit" runat="server" CommandName="Edit"></asp:LinkButton></td>
                <td><asp:LinkButton ID="DeleteButton" Text="Delete" runat="server" CommandName="Delete"></asp:LinkButton></td>
            </tr>
        </ItemTemplate>
        <EditItemTemplate>
            <tr>
                <td>
                    <asp:TextBox ID="CategoryNameTextBox" runat="server" Text='<%# Bind("CategoryName") %>' MaxLength="50"/>
                    <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("CategoryID") %>' Visible="false"/>
                </td>
                <td>
                    <asp:LinkButton ID="SaveButton" runat="server" Text="Save" CommandName="Update" CommandArgument='<%# Eval("CategoryID") %>' />   
                </td>
            </tr>
        </EditItemTemplate>
        <InsertItemTemplate>
            <tr>
                <td>
                    <asp:TextBox ID="InsertItemTextBox" runat="server" MaxLength="50"></asp:TextBox>
                </td>
                <td>
                    <asp:LinkButton ID="InsertButton1" runat="server" Text="Insert" CommandName="Insert"></asp:LinkButton>
                </td>
            </tr>
        </InsertItemTemplate>
    </asp:ListView>
</asp:Content>
